package com.sg.hms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sg.hms.Service.H_MoneyAppliFinishService;
import com.sg.hms.ServiceImpl.H_MoneyAppliFinishServiceImpl;

import net.sf.json.JSONObject;
/**
 * 
 * @author 王奇霞
 *
 */
public class MoneyAppliFinishController extends HttpServlet{
      
	private H_MoneyAppliFinishService maservice=new H_MoneyAppliFinishServiceImpl();
	@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	doPost(req, resp);
    }
      @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	  req.setCharacterEncoding("utf-8");
      	resp.setCharacterEncoding("utf-8");
      	PrintWriter pw=resp.getWriter();
      	int page=Integer.parseInt(req.getParameter("page"));
      	int pagesize=Integer.parseInt(req.getParameter("rows"));
      //	System.out.println(page+" "+pagesize);
      	int start=(page-1)*pagesize;
      	JSONObject mapps=null;
      	mapps=maservice.searchFinishmoneyappli(start, pagesize);
      	pw.write(mapps.toString());
    }
}
